import java.awt.*;
import java.awt.event.*;

public class DrawingCanvasListener 
     implements MouseListener, MouseMotionListener {

  protected DrawingCanvas canvas;
  protected Point startingMousePosition;

  /* Constructor */
  public DrawingCanvasListener(DrawingCanvas canvas) {
    this.canvas=canvas;
  }

  public void mousePressed(MouseEvent e) {
	    Tool tool = canvas.getCurrentTool();
	    if (tool != null) {
	      tool.mousePressed(e);
	    }
	  }

	  public void mouseReleased(MouseEvent e) { 
	    Tool tool = canvas.getCurrentTool();
	    if(tool != null) {
	      tool.mouseReleased(e);
	    }
	  }

	  public void mouseDragged(MouseEvent e) {
	    Tool tool = canvas.getCurrentTool();
	    if(tool != null) {
	      tool.mouseDragged(e);
	    }
	  }

  /* Null listener methods */

  public void mouseClicked(MouseEvent e) {}
  public void mouseEntered(MouseEvent e) {}
  public void mouseExited(MouseEvent e) {}
  public void mouseMoved(MouseEvent e) {}

} /* end of class DrawingCanvasListener */
